home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / Wisdom_Quo199211552006.psc / Wisdom Quotes / Data.bas next >
BASIC Source File  |  2006-05-04  |  1KB  |  61 lines

  1. Attribute VB_Name = "txtDataB"
  2. Option Explicit
  3. Type Entry
  4. Author As String
  5. Quote As String
  6. End Type
  7. Public TotalEntrys As Long
  8. Public Entrys() As Entry
  9.  
  10.  
  11.  
  12. Function LoadFile() As String
  13. Open "quotes.txt" For Binary As #1
  14. LoadFile = Input$(LOF(1), 1)
  15. Close #1
  16. End Function
  17. Sub LoadCates()
  18. Form1.Combo1.Clear
  19.     Dim A1 As String, Str As String, A2() As String, a4 As Long, A3() As String
  20.     
  21.     A1 = LoadFile
  22.     
  23.     A2 = Split(A1, "<##QUOTE##>")
  24.     TotalEntrys = UBound(A2) - 1
  25.     For a4 = 0 To UBound(A2) - 1
  26.     A3 = Split(LCase(A2(a4)), "<blockquote>")
  27.     If InStr(1, Str, Replace(A3(0), " ", "_")) > 0 Then GoTo OK
  28.     Form1.Combo1.AddItem A3(0)
  29.     Str = Str & " " & Replace(A3(0), " ", "_")
  30.     
  31. OK:
  32.     
  33.     Next
  34.     Str = vbNullString
  35.     End Sub
  36.     'Add Data SubRoutine
  37.  
  38. 'Load List in the Var Entrys
  39. Public Sub LoadList(Cate As String)
  40. Dim A1 As String, Str As String, A2() As String, a4 As Long, A3() As String
  41.     
  42.     A1 = LoadFile
  43.     A2 = Split(A1, "<##QUOTE##>")
  44.     ReDim Entrys(0)
  45.     For a4 = 0 To UBound(A2) - 1
  46.     A3 = Split(LCase(A2(a4)), "<blockquote>")
  47.     If A3(0) = Cate Then
  48.         ReDim Preserve Entrys(UBound(Entrys) + 1)
  49.         Entrys(UBound(Entrys)).Author = A3(0)
  50.         Entrys(UBound(Entrys)).Quote = A3(1)
  51.         End If
  52.         Next
  53.  
  54. Exit Sub
  55.  
  56. err:
  57.     MsgBox "CANNOT LOAD LIST" & vbCrLf & vbCrLf & "Error : " & err.Description
  58.     
  59. End Sub
  60.  
  61.